
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>登录</title>
    <meta content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" name="viewport"/>
    <meta content="yes" name="apple-mobile-web-app-capable"/>
    <meta content="black" name="apple-mobile-web-app-status-bar-style"/>
    <meta content="telephone=no" name="format-detection"/>
    <link href="__STATIC__/assets/css/login.css" rel="stylesheet" type="text/css"/>
    <script src="__STATIC__/index/item2_files/jquery.min.js" language="javascript" type="text/javascript"></script>
</head>
<body>
<section class="aui-flexView">
    <header class="aui-navBar aui-navBar-fixed">
        <a href="javascript:;" onclick="history.go(-1)" class="aui-navBar-item">
            <i class="icon icon-return"></i>
        </a>
        <div class="aui-center">
            <span class="aui-center-title">登录</span>
        </div>
        <a href="javascript:;" class="aui-navBar-item">
            <i class="icon icon-news"></i>
        </a>
    </header>
    <section class="aui-scrollView">
        <div class="aui-code-box">
            <div class="aui-code-logo">
                <div class="aui-code-logo-img">
                    <img src="__STATIC__/assets/WechatIMG1.png" alt="">
                </div>
                <h2></h2>
            </div>
            <form action="{:url('checkLogin')}" method="post">
                <p class="aui-code-line">
                    <input type="text" name="phone" class="aui-code-line-input" name="search" value="" id="phone1" autocomplete="off" placeholder="请输入手机号"/>
                </p>
                <p class="aui-code-line aui-code-line-clear">
                    <input type="text" name="yzcode" class="aui-code-line-input" placeholder="短信验证码" value="">
                    <input id="btnSendCode1" type="button" class="aui-btn-default" value="获取验证码" onClick="sendMessage1()"/>
                </p>
                <div class="aui-code-btn">
                    <button>登录</button>
                </div>
            </form>
        </div>
    </section>
</section>
<script type="text/javascript">
    (function($) {
            $.fn.extend({
                addClear: function(options) {
                    var options = $.extend({
                        closeSymbol: "&#10006;",
                        color: "#CCC",
                        top: 1,
                        right: 4,
                        returnFocus: true,
                        showOnLoad: false,
                        onClear: null
                    }, options);

                    $(this).wrap("<span style='position:relative;' class='add-clear-span'>");
                    $(this).after("<a href='#clear'>" + options.closeSymbol + "</a>");
                    $("a[href='#clear']").css({
                        color: options.color,
                        'text-decoration': 'none',
                        display: 'none',
                        'line-height': 1,
                        overflow: 'hidden',
                        position: 'absolute',
                        right: options.right,
                        top: options.top
                    }, this);

                    if ($(this).val().length >= 1 && options.showOnLoad === true) {
                        $(this).siblings("a[href='#clear']").show();
                    }

                    $(this).keyup(function() {
                        if ($(this).val().length >= 1) {
                            $(this).siblings("a[href='#clear']").show();
                        } else {
                            $(this).siblings("a[href='#clear']").hide();
                        }
                    });

                    $("a[href='#clear']").click(function() {
                        $(this).siblings("input").val("");
                        $(this).hide();
                        if (options.returnFocus === true) {
                            $(this).siblings("input").focus();
                        }
                        if (options.onClear) {
                            options.onClear($(this).siblings("input"));
                        }
                        return false;
                    });
                    return this;
                }
            });
        }
    )(jQuery);

    var phoneReg = /(^1[3|4|5|7|8]\d{9}$)|(^09\d{8}$)/;
    var count = 60;
    var InterValObj1;
    var curCount1;
    function sendMessage1() {
        curCount1 = count;
        var phone = $.trim($('#phone1').val());
        if (!phoneReg.test(phone)) {
            alert(" 请输入有效手机号码！");
            return false;
        }

        $.ajax({
            'type' : 'post',
            'url' : '{:url("sendMessage")}',
            'data': {phone:$('input[name=phone]').val()}
        });
        $("#btnSendCode1").attr("disabled", "true");
        $("#btnSendCode1").val(+curCount1 + "秒后再发送");
        InterValObj1 = window.setInterval(SetRemainTime1, 1000);

    }
    function SetRemainTime1() {
        if (curCount1 == 0) {
            window.clearInterval(InterValObj1);
            $("#btnSendCode1").removeAttr("disabled");
            $("#btnSendCode1").val("获取验证码");
        } else {
            curCount1--;
            $("#btnSendCode1").val(+curCount1 + "秒后再发送");
        }
    }
</script>
</body>
</html>
